const Koa = require('koa')
const fs = require('fs')
const route = require('koa-route')
const app = new Koa()
const host = '127.0.0.1'
const port = 8080

const main = ctx => {
 ctx.response.type = 'html'
 ctx.response.body = fs.createReadStream('./index.html')
}

app.use(route.get('/', main))

app.use(main)
app.listen(port, () => {
 console.log(`service is running at http://${host}:${port}`)
})